/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/16 18:30
  *
  * @file       pd_timer_ch.c
  * @brief      timer channel and gpio peripheral driver.
  *
  * @note       This file contains the driver for the timer channel and gpio.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/16     Chris        the first version
  *
  ******************************************************************************
  */


#include "pd_timer_ch.h"

static void TimerCh_init_(const TimerCh *this) {
    for (int i = 0; i < this->gpioSize; ++i) GPIO_init(&this->gpios[i]);
}

void TimerCh_constructor(TimerCh *this, GPIO *gpios, uint8_t gpioSize, uint32_t *channels, uint8_t chSize) {
    static struct TimerChVtbl vtbl = {
        .init = &TimerCh_init_,
    };

    this->vptr = &vtbl;

    this->gpios = gpios;
    this->gpioSize = gpioSize;
    this->channels = channels;
    this->chSize = chSize;
}
